import { defaultPayClass } from '@/api/server/v2/pay'

export const PaymentMethodOpt: TYPE_PaymentMethodOpt = [
  { label: '现付', value: '0' },
  { label: '预授权', value: '1' }
]

export type TYPE_PaymentMethodOpt = Array<{ label: string; value: string }>

export const receiveMan = function (): INF_receiveMan_info {
  return {
    Key: 0,
    Code: '', // 身份证号
    BreakFastNum: 0, // 早餐数量
    Name: '', // 	 maxLength: 20  姓名
    Tel: '',
    Sex: '',
    VipNo: '', //
    MainFlag: true, // 主客标识
    Addr: '', // maxLength: 100 地址
    Note: '',
    Birt: '',
    Price: 0,
    RoomClass: '', // 房型
    CheckIn: '',
    CheckOut: '',
    RoomNo: '',
    Nation: '', // maxLength: 50
    headPhoto: '', // 证件头像照片
    CertificatePhoto: '', // 资料页照片
    ForeignGuests: true, // 是否外宾
    NationRegion: '', // 国籍
    Reasons: '' // 入境事由
  }
}

export interface INF_receiveMan_info {
  Key: number
  Code: string // 身份证号
  BreakFastNum: number // 早餐数量
  Name: string // 	 maxLength: 20  姓名
  Tel: string
  Sex: string
  VipNo: string //
  MainFlag: boolean // 主客标识
  Addr: string // maxLength: 10number 地址
  Note: string
  Birt: string
  Price: number
  RoomClass: string // 房型
  CheckIn: string
  CheckOut: string
  RoomNo: string
  Nation: string // maxLength: 50
  headPhoto: string // 证件头像照片
  CertificatePhoto: string // 资料页照片
  ForeignGuests: boolean // 是否外宾
  NationRegion: string // 国籍
  Reasons: string // 入境事由
}

export const receiveRoomInfo = function (): INF_RoomInfo {
  return {
    RoomNo: '', // 房号
    HomeClassId: 0, // 房型编号
    RoomClass: '', // 	string 房型
    Price: 0, // 	number($double) 价格
    ReceiveMan: [
      // 一个房间可以有多个入住人
      receiveMan()
    ]
  }
}
export const receiveParams = function (): INF_NewParams {
  return {
    ReceiveClass: 'ALL', // 入住类型 // 0全天 1钟点 2自用 4日租房
    WillLeave: '',
    Bc: '',
    TheCompanyId: 0, // integer($int32)
    GuestName: '', // 团队名
    TheClass: '散客', //  客源类型 require 	string maxLength: 20 minLength: 0
    XsName: '', // 销售员
    BookMan: '', //
    VipNo: '', // 会员卡号
    Tel: '',
    BreakFastNum: 0,
    BookId: '', // 预订单号
    LinkId: '', // 预订单中的联房单号
    BookServiceMan: '',
    Zk: 0,
    Note: '', // 提醒内容
    Rooms: [
      // 一次办理入住可以办理多个房间
      receiveRoomInfo()
    ],
    TheCompany: '',
    Notice: '',
    ReceiveType: 0,
    HousingPrice: '',
    VipData: [],
    TelOrCardId: '',
    VipId: 0, // integer($int32) 会员内部号
    VipLev: '', // 会员类型
    Days: 1, // integer($int32) 入住天数
    PaymentMethodOpt,
    PaymentTypeOpt: [],
    PaymentMethod: defaultPayClass.Id,
    PaymentType: '',
    CollectionAmount: 0,
    ZkName: '',
    BankCardNo: '',
    AuthCode: '',
    Duration: '',
    OriginalPrice: '',
    Rackrate: '',
    HourTimeoutPrice: 25,
    TeamName: '',
    ContractNo: '',
    PaymentPrice: 0
  }
}

export interface INF_NewParams {
  ReceiveClass: string
  WillLeave: string
  Bc: string
  TheCompanyId: number
  GuestName: string
  TheClass: string
  XsName: string
  BookMan: string
  VipNo: string
  Tel: string
  BreakFastNum: number
  BookId: string
  LinkId: string
  BookServiceMan: string
  Zk: number
  Note: string
  Rooms: Array<INF_RoomInfo>
  TheCompany: string
  Notice: string
  ReceiveType: number
  HousingPrice: string
  VipData: any[]
  TelOrCardId: string
  VipId: number
  VipLev: string
  Days: number
  PaymentMethodOpt: TYPE_PaymentMethodOpt
  PaymentTypeOpt: any[]
  PaymentMethod: number
  PaymentType: string
  CollectionAmount: number
  ZkName: string
  BankCardNo: string
  AuthCode: string
  Duration: string
  OriginalPrice: string
  Rackrate: string
  HourTimeoutPrice: number
  TeamName: string
  ContractNo: string
  PaymentPrice: number
}

export interface INF_RoomInfo {
  RoomNo: string
  HomeClassId: number
  RoomClass: string
  Price: number
  ReceiveMan: INF_GuestInfo[]
}

export interface INF_GuestInfo {
  Key: number
  Code: string
  BreakFastNum: number
  Name: string
  Tel: string
  Sex: string
  VipNo: string
  MainFlag: boolean
  Addr: string
  Note: string
  Birt: string
  Price: number
  RoomClass: string
  CheckIn: string
  CheckOut: string
  RoomNo: string
  Nation: string
  headPhoto: string
  CertificatePhoto: string
  ForeignGuests: boolean
  NationRegion: string
  Reasons: string
}

export interface INF_ReceiveClassOption {
  name: '全天' | '钟点' | '自用|免费'
  value: 'ALL' | 'DU' | 'HU'
  id: number
}

export const ReceiveClassOptions: Array<INF_ReceiveClassOption> = [
  {
    name: '全天',
    value: 'ALL',
    id: 0
  },
  {
    name: '钟点',
    value: 'DU',
    id: 1
  },
  {
    name: '自用|免费',
    value: 'HU',
    id: 2
  }
]
